package com.wyvoid.core.mvc.stripes;

import net.sourceforge.stripes.controller.NameBasedActionResolver;

/**
 * <p>51void.com</p>
 * User:cjp
 * Date: 2007-5-14
 * Time: 21:16:29
 */
public class AbleNameBasedActionResolver extends NameBasedActionResolver {
    protected String getUrlBinding(String string) {
        String original = super.getUrlBinding(string);

        try {
            int end = original.indexOf(".do");
            if(end==-1) return original;
            String temp = original.substring(0, end);
            int begin = temp.lastIndexOf("/");
            String name = original.substring(begin + 1, end);
            name = name.substring(0, 1).toLowerCase() + name.substring(1);

            return original.substring(0, begin + 1).toLowerCase() + name;
        } catch (Throwable e) {
//            e.printStackTrace();
            return original;
        }
    }
}
